home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
B-Book Series
/
(k)b2.d64
/
auntie
< prev
next >
Wrap
Text File
|
2007-02-28
|
4KB
|
211 lines
0010 //* AUNT LOUISE'S PROGRAM *//
0020 //* WRITTEN BY ELISABETH OLDHAM *//
0030 //* IN COOPERATION WITH LOUISE OLSEN *//
0040 //* THIS VERSION: 9. JAN. 1981 *//
0050 //*
0060 //DECLARATION OF STRINGS//
0070 DIM NAME$ OF 30, TYPE$ OF 3, SIGN$ OF 1
0080 DIM SPACES$ OF 39
0100 //*
0110 //SET UP SOME CONSTANTS//
0140 MAXNO:=10; BASE:=20
0150 THISNAME:=1; THISTYPE:=2; THISLEVEL:=3
0160 SPACES$(1:39):=""
0170 //*
0180 //MAINLINES//
0190 PRINT CHR$(147) //CLEAR SCREEN
0200 TAKEIN(THISNAME)
0210 REGISTER
0220 TAKEIN(THISTYPE)
0230 TAKEIN(THISLEVEL)
0240 EXERCISES
0250 RECORD
0260 //*
0270 PROC EXERCISES
0280 FOR EXERCISENO:=1 TO MAXNO DO
0290 WORKSHOP
0300 WRITEEXERCISE
0310 GETANSWER
0320 ENDFOR EXERCISENO
0330 ENDPROC EXERCISES
0340 //
0350 PROC RECORD
0360 //
0370 //STUD//
0380 //
0390 ENDPROC RECORD
0400 //
0410 PROC TAKEIN(MATTER)
0420 ENTRY
0430 WHILE NOT OK DO
0440 ERROR
0450 ENTRY
0460 ENDWHILE
0470 ENDPROC TAKEIN
0480 //
0490 PROC ENTRY
0500 WINDOW(8,12)
0510 CASE MATTER OF
0520 WHEN 1
0530 PRINT "WHAT IS YOUR NAME",
0540 INPUT NAME$
0550 WHEN 2
0560 PRINT "ENTER TYPE (ADD, SUB, MUL, DIV)",
0570 INPUT TYPE$
0580 WHEN 3
0590 PRINT "ENTER LEVEL (1, 2, 3)",
0600 INPUT LEVEL
0610 ENDCASE
0620 PRINT CHR$(147) //CLEAR SCREEN
0630 CONTROL
0640 ENDPROC ENTRY
0650 //
0660 PROC CONTROL
0670 CASE MATTER OF
0680 WHEN 1
0690 OK:=(" " IN NAME$)
0700 WHEN 2
0710 OK:=(TYPE$="ADD" OR TYPE$="SUB")
0720 LACKS:=(TYPE$="MUL" OR TYPE$="DIV")
0730 WHEN 3
0740 OK:=(LEVEL=1 OR LEVEL=2 OR LEVEL=3)
0750 ENDCASE
0760 ENDPROC CONTROL
0770 //
0780 PROC ERROR
0790 WINDOW(1,2)
0800 CASE MATTER OF
0810 WHEN 1
0820 PRINT "MOST PEOPLE HAVE BOTH A FIRST NAME"
0830 PRINT "AND A SURNAME. PLEASE GIVE BOTH!"
0840 WHEN 2
0850 PRINT "NO SUCH TYPE OF EXERCISE!"
0860 IF LACKS THEN
0870 PRINT "MUL AND DIV ARE NOT YET INSERTED"
0880 PRINT "PLEASE PICK OUT ADD OR SUB"
0890 ENDIF
0900 WHEN 3
0910 PRINT "NO SUCH LEVEL OF EXERCISES!"
0920 ENDCASE
0930 ENDPROC ERROR
0940 //
0950 PROC REGISTER
0960 //
0970 //STUD//
0980 //
0990 ENDPROC REGISTER
1000 //
1010 PROC WORKSHOP
1020 CASE TYPE$ OF
1030 WHEN "ADD"
1040 ADDITION
1050 WHEN "SUB"
1060 SUBTRACTION
1070 WHEN "MUL"
1080 MULTIPLICATION
1090 WHEN "DIV"
1100 DIVISION
1110 ENDCASE
1120 ENDPROC WORKSHOP
1130 //
1140 PROC ADDITION
1150 CASE LEVEL OF
1160 WHEN 1
1170 N1:=RND(0,5); N2:=RND(0,5)
1180 WHEN 2
1190 N1:=RND(0,9); N2:=RND(0,9)
1200 WHEN 3
1210 N1:=RND(40,50); N2:=RND(1,10)
1220 ENDCASE
1230 RESULT:=N1+N2
1240 SIGN$:="+"
1250 ENDPROC ADDITION
1260 //
1270 PROC SUBTRACTION
1280 CASE LEVEL OF
1290 WHEN 1
1300 N1:=RND(5,9); N2:=RND(1,5)
1310 WHEN 2
1320 N1:=RND(10,19); N2:=RND(1,10)
1330 WHEN 3
1340 N1:=RND(50,89); N2:=RND(10,19)
1350 ENDCASE
1360 RESULT:=N1-N2
1370 SIGN$:="-"
1380 ENDPROC SUBTRACTION
1390 //
1400 PROC MULTIPLICATION
1410 //
1420 //STUD//
1430 //
1440 ENDPROC MULTIPLICATION
1450 //
1460 PROC DIVISION
1470 //
1480 //STUD//
1490 //
1500 ENDPROC DIVISION
1510 //
1520 PROC GETANSWER
1530 TRY:=1
1540 ENTERANSWER
1550 WHILE NOT OK DO
1560 HELP
1570 WRITEEXERCISE
1580 ENTERANSWER
1590 TRY:+1
1600 ENDWHILE
1610 ENDPROC GETANSWER
1620 //
1630 PROC ENTERANSWER
1640 TABULATOR(RESULT)
1650 INPUT "": ANSWER
1660 OK:=(ANSWER=RESULT)
1670 PRINT CHR$(147) //CLEAR SCREEN
1680 ENDPROC ENTERANSWER
1690 //
1700 PROC WRITEEXERCISE
1710 WINDOW(7,15)
1720 CASE TYPE$ OF
1730 WHEN "ADD","SUB"
1740 TABULATOR(N1)
1750 PRINT N1
1760 PRINT TAB(BASE-3),SIGN$,
1770 TABULATOR(N2)
1780 PRINT N2
1790 PRINT TAB(BASE-3),"====="
1800 WHEN "MUL","DIV"
1810 //
1820 //STUD//
1830 //
1840 ENDCASE
1850 ENDPROC WRITEEXERCISE
1860 //
1870 PROC HELP
1880 WINDOW(1,2)
1890 IF TRY<3 THEN
1900 PRINT "NO, TRY AGAIN"
1910 ELSE
1920 PRINT "NO, THE CORRECT ANSWER IS ",RESULT
1930 PRINT "TYPE THAT."
1940 ENDIF
1950 ENDPROC HELP
1960 //
1970 PROC TABULATOR(T)
1980 POSITION:=BASE-(T>=10)-(T>=100)
1990 PRINT TAB(POSITION),
2000 ENDPROC TABULATOR
2010 //
2020 PROC WINDOW(FIRST,LAST)
2030 SCREEN(FIRST,1)
2040 FOR I:=1 TO LAST-FIRST+1 DO PRINT SPACES$
2050 SCREEN(FIRST,1)
2060 ENDPROC WINDOW
2070 //
2080 PROC SCREEN(ROW,COL) CLOSED
2090 PRINT CHR$(19) //CURSOR HOME
2100 FOR I:=1 TO ROW DO PRINT //CURSOR DOWN
2105 FOR I:=1 TO COL-1 DO PRINT CHR$(29), //CURSOR RIGHT
2110 ENDPROC SCREEN
2120 //